package cron.core.thread;


import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author : willian fu
 * @version : 1.0
 * @date : 2021/2/26 0026 17:19
 */
public class ThreadPoolConfig {

    private static ThreadPoolExecutor defaultPool;

    public static ThreadPoolExecutor getDefault(){
        synchronized (ThreadPoolConfig.class){
            if (null == defaultPool){
                defaultPool = new ThreadPoolExecutor(2, 100,
                        5 * 60, TimeUnit.SECONDS, new LinkedBlockingQueue<>());
            }
            return defaultPool;
        }

    }
}
